mcN = "letter";

alphaInc = (0     - 100) / increments;
scaleInc = (scale - 100) / increments;

aLetters = new Array();

for (i = 0; i< numChar; i++)
{
  aLetters[i+0] = i;
  var letter =  this[mcN +i];
  letter._visible = true;
  letter.init = letterInit;
  letter.doEffect = effect;
  letter.number = i;
}

function letterInit()
{
  if (this.timerStarted == 1)
  {
  } 
  else
  {
    this.timerStarted = 0;
  }

  this._visible = true;
  this.step = 0;
  this.increments = this._parent.increments;
  this._alpha = 100;
  this.alphaInc = this._parent.alphaInc;
  this.scaleInc = this._parent.scaleInc;

  this.scale = 100;

  this.angle1 = 720 * Math.random() - 360;
  this.angle2 = 720 * Math.random() - 360;

  this.angle1Inc = (this.angle1 - 0) / this.increments;
  this.angle2Inc = (this.angle2 - 0) / this.increments;

  this.angle1 = 0;
  this.angle2 = 0;

  // inner movie clip
  this.letter._rotation = -45;

  this._rotation = 45;
  this._xscale = 100;
  this._yscale = 100;
}

function effect()
{
  if (this.timerStarted == 0)
  {
     this.start = getTimer();
     this.timerStarted = 1;
     this.gotoAndPlay(3);
  } 
  else
  {
     if (getTimer() > (this.start + this._parent.startDelay))
     {
        this._alpha  += this.alphaInc;
        this.scale   += this.scaleInc;

        this.angle1 += this.angle1Inc;
        this.angle2 += this.angle2Inc;

        this._rotation = (this.angle1 + this.angle2) * .5 + 45;

        radian = 3.1416 / 180;

        angle1Rad = this.angle1 * radian;
        angle2Rad = this.angle2 * radian;

        sin45 = Math.sin(45 * radian);

        sinAngles = Math.sin(((this.angle1 + this.angle2) * .5 + 45) * radian);

        if (sinAngles == 0)
           sinAngles = 1;

        this._xscale = this.scale * (Math.cos(angle1Rad) + Math.sin(angle2Rad)) * sin45 / sinAngles;

        this._yscale = this.scale * (Math.sin(angle1Rad) + Math.cos(angle2Rad)) * sin45 / sinAngles;

       this.step += 1;

       if (this.step >= this.increments)
       {
          this.gotoAndStop("end");
          this._xscale = 100;
          this._yscale = 100;
          this._rotation = 45;
          this._alpha = 100;
          this._visible = false;
          this.timerStarted = 0;
       }
    }
    else
    {
       this.gotoAndPlay(3);
    }
  }
}

function shuffle()
{
  return Math.floor(Math.random() * 3) -1;
}

if (random == 1)
{
  aLetters.sort(shuffle);
}

if (reverse == 1)
{
  aLetters.reverse();
}